<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<!DOCTYPE html>

<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->

<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->

<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->

<!-- BEGIN HEAD -->

<head>

	<meta charset="utf-8" />

	<title></title>


</head>

<!-- END HEAD -->

<!-- BEGIN BODY -->

<body class="page-header-fixed">

	<!-- BEGIN CONTAINER -->

	<div class="page-container row-fluid">

		<!-- BEGIN SIDEBAR -->

			<!-- Import Menu -->        
			<jsp:include page="/WEB-INF/adminLayouts/menu.jsp"></jsp:include>

		<!-- END SIDEBAR -->

		<!-- BEGIN PAGE -->

		<div class="page-content">

			<!-- BEGIN PAGE CONTAINER-->        

			<div class="container-fluid">

				<!-- BEGIN PAGE HEADER-->

				<c:if test="${not empty message}">
					<div id="message" class="alert alert-success"><button data-dismiss="alert" class="close"></button>${message}</div>
				</c:if>
				<div class="row-fluid">

					<div class="span12">

						<!-- BEGIN STYLE CUSTOMIZER -->
						<!-- Import Style Setting Button -->        
						<jsp:include page="/WEB-INF/adminLayouts/style-setting.jsp"></jsp:include>
						<!-- END BEGIN STYLE CUSTOMIZER -->  

						<!-- BEGIN PAGE TITLE & BREADCRUMB-->
						<h3 class="page-title">会员卡列表</h3>
						<ul class="breadcrumb">
							<li>
								<i class="icon-home"></i>
								<a href="${ctx}">首页</a> 
								<i class="icon-angle-right"></i>
							</li>
							<li>会员卡列表</li>
						</ul>
						<!-- END PAGE TITLE & BREADCRUMB-->
					</div>
				</div>

				<!-- END PAGE HEADER-->

				<!-- BEGIN PAGE CONTENT-->

				<div class="row-fluid">
					<div class="">
						<!-- BEGIN BORDERED TABLE PORTLET-->
						<div class="portlet box red">
							<div class="portlet-title">
								<div class="caption"><i class="icon-user"></i> 会员卡列表</div>
								<div class="tools">
								<shiro:hasRole name="sadmin">
									<a class="btn" target="_blank" href="${ctx}/admin/card/createCard">创建会员卡</a>
								</shiro:hasRole>
									<a href="javascript:;" class="collapse"></a>
								</div>
							</div>

							<div class="portlet-body">
								<table class="table table-striped table-bordered  table-hover">
									<thead>
										<tr>
											<th>#</th>
											<th>CardName</th>
											<th>CardId</th>
											<th>状态</th>
											<th>创建时间</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
										<c:forEach items="${cardList}" var="card" varStatus="status">
										<tr>
											<td>${status.count}</td>
											<td>${card.cardName}</td>
											<td><a target="_blank" href="${ctx}/admin/card/info/${card.cardId}">${card.cardId}</a></td>
											<td>${card.status}</td>
											<td>
												<fmt:formatDate value="${card.createDate}" pattern="yyyy-MM-dd  HH:mm:ss" />
											</td>
											<td>
												<a href="${ctx}/admin/card/cardUserList/${card.cardId}" class="btn mini green"><i class="icon-user"></i> 会员信息 (${card.users})</a>
												<shiro:hasRole name="sadmin">
													<a href="javascript:delConfirm('${ctx}/admin/card/delete/${card.cardId}');" class="btn mini black"><i class="icon-trash"></i> 删除</a>
												</shiro:hasRole>
											</td>
										</tr>
										</c:forEach>
										
									</tbody>

								</table>

							</div>


						</div>
	<script>
		function delConfirm(del_url){
			bootbox.dialog({
				  message: "删除后不可恢复，是否删除数据？",
				  title: "删除确认",
				  buttons: {
				    success: {
				      label: "取消",
				      className: "btn"
				    },
				    danger: {
				      label: "删除",
				      className: "btn black",
				      callback: function() {
				    	  location.href = del_url;
				      }
				    }
				  }
			});
		}
	
    </script>
		

						<!-- END BORDERED TABLE PORTLET-->

					</div>

				</div>

				<!-- END PAGE CONTENT-->

			</div>

			<!-- END PAGE CONTAINER-->

		</div>

		<!-- END PAGE -->

	</div>
</body>
	
</html>
